SpringAI instrumentation enhancements#49
Conversation
7797207 to
bfab183
Compare
bfab183 to
a864833
Compare
e19ed25 to
089422a
Compare
089422a to
9b860f0
Compare
9b860f0 to
9c5e9da
Compare
..._0/src/main/java/dev/braintrust/instrumentation/springai/v1_0_0/AnthropicBuilderWrapper.java
Outdated
Show resolved
Hide resolved
| // ------------------------------------------------------------------------- | ||
|
|
||
| @lombok.SneakyThrows | ||
| static void tagSpanRequest(Span span, org.springframework.ai.chat.prompt.Prompt prompt) { |
There was a problem hiding this comment.
There's a lot of duplicate logic in both the anthropic and openai wrapper, like this function tagSpanRequest. Worth DRYing up?
There was a problem hiding this comment.
I think I'll leave it as-is for now. I'm not sure if the similarities are more of a coincidence vs DRYable design, but I'll revisit if this pattern repeats
| "https://api.anthropic.com", | ||
| List.of("v1", "messages"), | ||
| "POST", | ||
| BraintrustJsonMapper.toJson(requestBody)); |
There was a problem hiding this comment.
can the json serialization throw? lombok.SneakyThrows will just rethrow and crash the app right (never seen SneakyThrows before so unfamiliar)?
There was a problem hiding this comment.
Yeah, it can throw. I added exception handling and debug logging to the braintrust observer to address this
| import org.springframework.ai.chat.prompt.Prompt; | ||
| import org.springframework.ai.openai.OpenAiChatModel; | ||
|
|
||
| /** Braintrust Spring AI instrumentation entry point. */ |
There was a problem hiding this comment.
we need to update this docstring.
There was a problem hiding this comment.
Those docstrings didn't really add much, so I just removed them
...i_1_0_0/src/main/java/dev/braintrust/instrumentation/springai/v1_0_0/BraintrustSpringAI.java
Show resolved
Hide resolved
9c5e9da to
6301578
Compare
also made some changes to muzzle to better support the multi chat model stuff springai provides